package org.aplombh.java.utils;

public class Pair implements Comparable<Pair> {
    public int l;
    public int r;

    public Pair(int l, int r) {
        this.l = l;
        this.r = r;
    }

    public Pair() {
    }

    public int getL() {
        return l;
    }

    public void setL(int l) {
        this.l = l;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    @Override
    public int compareTo(Pair o) {
        return this.l - o.l;
    }

    public Pair_r toR() {
        return new Pair_r(l, r);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Pair)
            return r - ((Pair) obj).r == 0 && l - ((Pair) obj).l == 0;
        else return false;
    }

    @Override
    public int hashCode() {
        return l + r;
    }
}